// import * as API from '../../api/api'
import TYPES from '../mutationsType'
const state = {
  cards: [
    [{
      value: '1',
      name: '三年卡 680元/3年/7次'
    }, {
      value: '2',
      name: '年卡 365元/年/7次'
    }, {
      value: '3',
      name: '次卡 188元/次'
    }]
  ],
  name: 'pppp',
  userInfo: {
    userMobile: ''
  },
  addr: ''
}
const mutations = {
  [TYPES.INIT](state, userinfo) {
    state.userInfo = userinfo
  },
  [TYPES.ADDR](state, addr) {
    state.addr = addr
  },
  [TYPES.SEARCH](state, searchList) {
    state.searchList = searchList
  },
  [TYPES.ORDER](state, order) {
    state.order = order
  },
  [TYPES.DATE](state, date) {
    state.date = date
  }
}
const actions = {
  initUser({
    commit,
    state
  }, param) {
    commit(TYPES.INIT, param)
  },
  initAddr({
    commit,
    state
  }, param) {
    commit(TYPES.ADDR, param)
  },
  initSearch({
    commit,
    state
  }, param) {
    commit(TYPES.SEARCH, param)
  },
  orderStore({
    commit,
    state
  }, param) {
    commit(TYPES.ORDER, param)
  },
  dateChoose({
    commit,
    state
  }, param) {
    commit(TYPES.DATE, param)
  }
}
const getters = {
  addr: state => state.addr,
  addList: state => state.addList,
  searchList: state => state.searchList,
  userInfo: state => state.userInfo,
  cards: state => state.cards,
  order: state => state.order,
  date: state => state.date
}

export default {
  state,
  mutations,
  actions,
  getters
}
